<?php
	defined('RUN') or die('No access');
	
	class SettingModel
	{
		public function getAll()
		{			
			$settings = Model::getData('settings');
			
			$result = array();
			
			foreach($settings as $setting)
			{
				$result[$setting['key']] = $setting['value'];
			}
			
			return $result;
		}
		
		public function update($page_name, $page_description, $page_keywords)
		{			
			$key = $value = "";
			$sql = "UPDATE `settings` SET `value` = :value WHERE `key` = :key";
			$query = Db::prepare($sql);
			$query->bindParam(':key', $key);
			$query->bindParam(':value', $value);
			
			$key = 'page_name';
			$value = $page_name;
			$query->execute();
			
			$key = 'page_description';
			$value = $page_description;
			$query->execute();
			
			$key = 'page_keywords';
			$value = $page_keywords;
			$query->execute();
		}
	}
